import { ChatOllama } from "@langchain/community/chat_models/ollama";

import { ChatPromptTemplate } from "@langchain/core/prompts";


const prompt = ChatPromptTemplate.fromMessages([
    [
        "system",
        `我是你的AI助手.`
    ],
    // ["human", `Translate "{input}" into {language}`]
    ["human", `"{input}" `]
])

const model = new ChatOllama({
    baseUrl: "http://10.11.27.60:11434",
    // model: "llama2-chinese:13b-chat-fp16",
    model: "qwen:14b-chat-q5_K_M",
    format: "json"
})

const chain = prompt.pipe(model)
const res = await chain.invoke({ input: "天空为什么是蓝色的" }) // language: "Chinese"
console.log(res.content);
